package test;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.anan.pojo.UserInfo;
import com.anan.pojo.UserInfoVo;
import org.testng.annotations.Test;

import java.util.ArrayList;
import java.util.List;

public class Mytest {

    @Test
    public void test1(){
        //对象的拷贝，从UserInfo ->  UserInfoVo
        //可以设置别名自动填充
        UserInfo userInfo=new UserInfo();
        userInfo.setId(1L);
        userInfo.setLogo("aaa.jpg");
        userInfo.setMarriage(3);

        UserInfoVo userInfoVo1 = BeanUtil.copyProperties(userInfo, UserInfoVo.class);
        System.out.println(userInfoVo1);

        UserInfoVo userInfoVo2 = BeanUtil.copyProperties(userInfo, UserInfoVo.class, "marriage");
        System.out.println(userInfoVo2);

        System.out.println(1);
        //分支3

        //分支2

        //另一个人敲得代码
    }

    @Test
    public void test2(){
        //获得集合的某一列
        //CollUtil.getFieldValues(visitorsList, "visitorUserId");

        //equals
        //ObjectUtil.equals(visitor.getVisitorUserId(), userInfo.getUserId())


        //是否为空 CollUtil.isEmpty(list)
        List<String> list=new ArrayList<>();
        System.out.println(CollUtil.isEmpty(list));

        String s="";
        System.out.println(StrUtil.isEmpty(s));

    }
}
